﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="com.burry.util.MapList" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Bary</title>
<link rel="stylesheet" type="text/css" id="css" href="Resource/css/main.css">


<link rel="stylesheet" type="text/css" href="Resource/yui/build/fonts/fonts-min.css" />
<link rel="stylesheet" type="text/css" href="Resource/yui/build/datatable/assets/skins/sam/datatable.css" />

<link rel="stylesheet" type="text/css" href="Resource/yui/build/logger/assets/skins/sam/logger.css" />
<link rel="stylesheet" type="text/css" href="Resource/yui/build/treeview/assets/skins/sam/treeview.css" />
<link rel="stylesheet" type="text/css" href="Resource/yui/build/button/assets/skins/sam/button.css" />

<!--Additional custom style rules for this example:-->
<style type="text/css">

.ygtvcheck0 { background: url(Resource/yui/assets/img/check/check0.gif) 0 0 no-repeat; width:16px; cursor:pointer }
.ygtvcheck1 { background: url(Resource/yui/assets/img/check/check1.gif) 0 0 no-repeat; width:16px; cursor:pointer }
.ygtvcheck2 { background: url(Resource/yui/assets/img/check/check2.gif) 0 0 no-repeat; width:16px; cursor:pointer }

</style>

<!--end custom header content for this example-->


<script type="text/javascript" src="Resource/yui/build/yuiloader/yuiloader-min.js"></script>
<script type="text/javascript" src="Resource/yui/build/event/event-min.js"></script>
<script type="text/javascript" src="Resource/yui/build/dom/dom-min.js"></script>
<script type="text/javascript" src="Resource/yui/build/logger/logger-min.js"></script>
<script type="text/javascript" src="Resource/yui/build/treeview/treeview-debug.js"></script>
<script type="text/javascript" src="Resource/yui/build/element/element-min.js"></script>
<script type="text/javascript" src="Resource/yui/build/button/button-min.js"></script>


<script type="text/javascript" src="../resource/js/global.js"></script>


<body id="yahoo-com" class=" yui-skin-sam">
	<div id="framed">
  	<h2>分类折扣</h2>
  </div>
  
  <div>
		<div>请选择分类</div>
<div id="catalogTree"></div>
<div>请录入数量要求</div>
<div><input type="text" value="" /></div>
<script type="text/javascript" src="../resource/js/TaskNode.js"></script>


		
		<div>
			
<script language="javascript">		
			(function() {
	var tree;
	var nodes = [];
	var nodeIndex;
	
	function treeInit() {
		
		buildRandomTaskNodeTree();
	}
	

	//Function  creates the tree and 
	//builds between 3 and 7 children of the root node:
    function buildRandomTaskNodeTree() {
	
		//instantiate the tree:
        tree = new YAHOO.widget.TreeView("catalogTree");

        for (var i = 0; i < Math.floor((Math.random()*4) + 3); i++) {
            var tmpNode = new YAHOO.widget.TaskNode("label-" + i, tree.getRoot(), false);
            // tmpNode.collapse();
            // tmpNode.expand();
            buildRandomTaskBranch(tmpNode);
        }


		//The tree is not created in the DOM until this method is called:
        tree.draw();
    }

	var callback = null;

	function buildRandomTaskBranch(node) {
		if (node.depth < 5) {
			//YAHOO.log("buildRandomTextBranch: " + node.index);
			for ( var i = 0; i < Math.floor(Math.random() * 4) ; i++ ) {
				var tmpNode = new YAHOO.widget.TaskNode(node.label + "-" + i, node, false);
                //tmpNode.onCheckClick = onCheckClick;
				buildRandomTaskBranch(tmpNode);
			}
		}
	}

    function onCheckClick(node) {

    }

    function checkAll() {
        var topNodes = tree.getRoot().children;
        for(var i=0; i<topNodes.length; ++i) {
            topNodes[i].check();
        }
    }

    function uncheckAll() {
        var topNodes = tree.getRoot().children;
        for(var i=0; i<topNodes.length; ++i) {
            topNodes[i].uncheck();
        }
    }

   // Gets the labels of all of the fully checked nodes
   // Could be updated to only return checked leaf nodes by evaluating
   // the children collection first.
    function getCheckedNodes(nodes) {
        nodes = nodes || tree.getRoot().children;
        checkedNodes = [];
        for(var i=0, l=nodes.length; i<l; i=i+1) {
            var n = nodes[i];
            //if (n.checkState > 0) { // if we were interested in the nodes that have some but not all children checked
            if (n.checkState === 2) {
                checkedNodes.push(n.label); // just using label for simplicity
            }

            if (n.hasChildren()) {
checkedNodes = checkedNodes.concat(getCheckedNodes(n.children));
            }
        }

        return checkedNodes;
    }


	YAHOO.util.Event.onDOMReady(treeInit);
})();

</script>			
		</div>
		
		<div><input type="button" value="上一步" onclick="preStep()" /> &nbsp;<input type="button" value="下一步" onclick="nextStep()" /></div>
		
		
		<script language="javascript">
			function nextStep(){
				var type = $('select').value ;
				if("1" == type){
					location = "addModel_global.jsp";
				}else{
					location = "addModel_catalog.jsp";
				}
			}	
			
			function preStep(){
				history.go(-1);
			}
		</script>
  </div>
</body>
</html>